<?php
session_start();
require '../nette/Nette/loader.php';
require '../db.php';
require '../localization/lang.php';
require '../core/core.sanitizer.php';
require '../core/core.security.php';
require '../core/core.time.php';
require '../visual/visual.tasks.php';

$login=new core_security;
if ($login->checklogin()=="OK") {

$time=new core_time;
$tasks=new visual_tasks($_SESSION['uid'],$_SESSION['date2']);
$lasstime=$tasks->visual_tasks_lasttime();
if ($lasstime != "") {
echo $time->totimedef($tasks->visual_tasks_lasttime());
} else {
$query="select start_time from users WHERE id=".$_SESSION['uid']."";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
if ($row['start_time'] == 'auto') {
	$currenttime=time();
	$dif=$currenttime % 900;
	$currenttime=$currenttime-$dif+900+($timediff*3600);
	echo $time->totimedef($currenttime);
	} else {
	echo $row['start_time'];
	}
}

}
?>
